/**
 * 
 */
package com.gite.nouette.admin.implementation.integrator.builder;

import com.gite.nouette.admin.contract.integrator.builder.IBuilderCommand;
import com.gite.nouette.admin.contract.integrator.factory.IFactoryModel;
import com.gite.nouette.admin.contract.model.command.IStateCommandActivation;

/**
 * @author Cyril
 * 
 */
public abstract class AbstractBuilderCommand extends AbstractBuilder implements
		IBuilderCommand {

	/**
	 * @param factoryModel
	 */
	public AbstractBuilderCommand(IFactoryModel factoryModel) {
		super(factoryModel);
	}

	@Override
	public void buildActivation() {
		IStateCommandActivation stateActive = getFactoryModel()
				.getStateCommandActive();
		IStateCommandActivation stateDesactive = getFactoryModel()
				.getStateCommandDesactive();
		stateActive.setCommand(getProduct());
		stateDesactive.setCommand(getProduct());
		getProduct().initActivation(stateActive, stateDesactive);
	}

	@Override
	public void buildObservable() {
		getProduct().setObservable(
				getFactoryModel().getObservableCommand(getProduct()));
	}
}
